Security News
Supply Chain Attack Detected in @solana/web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
repository-provider
Advanced tools
abstract interface to git repository providers like github, bitbucket and gitlab
abstract interface to git repository providers like github, bitbucket, gitlab, gitea, ...
see list of avaliable implementations below
import { Provider } from 'repository-provider';
const provider = new Provider({ /* access options as hosts and credentials */ });
const branch = await provider.branch('myuser/myrepo#myBranch');
for await (const entry of branch.entries('**/*.md')) {
console.log(entry.name);
}
const readme = await branch.entry('README.md');
console.log(await readme.string);
list by repository-provider keyword
Extends OwnedObject
Create properties from options and default options. Already present properties (direct) are skipped. The attribute list from the class will be applied to the options and merged with the given set of properties.
class aClass {
static get attributes() {
return { with_default: { default: 77 }};
}
}
definePropertiesFromOptions(new aClass());
// equivalent to
Object.definedProperties(new aClass(),{ with_default: { value: 77 }})
object
Object target objectoptions
Object as passed to object constructor (optional, default {}
)properties
Object object properties (optional, default {}
)attributes
Object? attribute meta info (optional, default object.constructor.attributes
)Get default values.
Returns Object filled with default values
Create json based on present options. In other words only produce key value pairs if value is defined.
object
Object initial
Object (optional, default {}
)attributes
Object to operator on (optional, default object.constructor.attributes
)Returns Object initial + defined values
Rename attributes. Filters out null, undefined and empty strings.
mapAttributes({a:1},{a:"a'"}) // {"a'": 1}
Returns Object keys renamed after mapping
Same as mapAttributes but with the inverse mapping. Filters out null, undefined and empty strings
Returns Object keys renamed after mapping
Type: Object
type
string writable
boolean private
boolean? should the value be showndepends
string? name of an attribute we depend onadditionalAttributes
Array<string> extra attributes that are present in case our attribute is setdescription
string default
any? the default valueset
Function? set the valueget
Function? get the value can be used to calculate default valuesenv
(Array<string> | string)? environment variable use to provide the valueSplit property path into tokens
string
string Set Object attribute. The name may be a property path like 'a.b.c'.
Deliver attribute value. The name may be a property path like 'a.b.c'.
Returns any value associated with the given property name
Deliver attribute value and operator. The name may be a property path like 'a.b.c <='.
Returns [any, string] value associated with the given property name
common attributes
The description of the object content.
Unique id within the provider.
The description of the pull request.
The one line description of the pull request.
In case there are several providers able to support a given source which one sould be used ? this defines the order
Creates an instance of BaseObject.
Takes values from options.
Save object attributes in the backing store.
Returns string fullName
Beautified name use for human displaying only.
Returns string human readable name
Complete name in the hierachy.
Returns string
Complete name in the hierachy.
Returns string
Name with default parts removed
Returns string
By default cannot be written to.
Returns boolean false
Check for equality
other
(BaseObject | undefined) Returns boolean true if other is present
Returns string type we represent
Tag -> tags
Repository -> repositories
Returns string name of the collection holding us in the owner
Attributes definitions
Returns Object
User modifyable attributes.
Returns Object writable attributes
Map attributes between external and internal representation.
Returns Object
Type: Object
Extends BaseObject
messageDestination
MessageDestination other
any Returns boolean true if other provider is the same as the receiver
All supported base urls. For github something like:
Returns Array<string> common base urls of all repositories
Does the provider support the base name.
base
string? to be checkedReturns boolean true if base is supported or base is undefined
Bring a repository name into its normal form by removing any clutter. Like .git suffix or #branch names.
Returns string normalized name
Bring a group name into its normal form by removing any clutter. Like .git suffix or #branch names.
Returns string normalized name
Are repository names case sensitive. Overwrite and return false if you want to have case insensitive repository lookup.
Returns boolean true
Are repositroy group names case sensitive. Overwrite and return false if you want to have case insensitive group lookup.
Returns boolean true
Parses repository name and tries to split it into base, group, repository and branch.
name
string? focus
string where lies the focus if only one path component is given (optional, default "repository"
)Returns Object with separated attributes
Create a repository.
Returns Promise<Repository>
List provider objects of a given type.
type
string name of the method to deliver typed iterator projects,milestones,hooks,repositories,branches,tagspatterns
(Array<string> | string | undefined) group / repository filterList projects.
Returns AsyncIterator<Project> all matching projects of the provider
List milestones.
Returns AsyncIterator<Milestone> all matching milestones of the provider
List repositories.
Returns AsyncIterator<Repository> all matching repos of the provider
List branches.
Returns AsyncIterator<Branch> all matching branches of the provider
List tags.
Returns AsyncIterator<Tag> all matching tags of the provider
List hooks.
Returns AsyncIterator<Hook> all matching hooks of the provider
List pull requests.
Returns AsyncIterator<PullRequest> all matching pullRequests of the provider
Deliver the provider name.
Returns string class name by default
We are our own provider.
Returns BaseProvider this
List all defined entries from attributes. return {object}
Prefix used to form environment variables. 'GITHUB_' -> 'GITHUB_TOKEN'
Returns string identifier for environment options
Extract options suitable for the constructor. Form the given set of environment variables. Object with the detected key value pairs is delivered.
env
Object? as from process.envinstanceIdentifier
string part of variable name. (optional, default this.instanceIdentifier
)Returns (Object | undefined) undefined if no suitable environment variables have been found
Check if given options are sufficient to create a provider.
options
Object Returns boolean true if options ar sufficient to construct a provider
Creates a new provider for a given set of options.
options
Object additional options (optional, default {}
)
options.instanceIdentifier
string? name of the provider instanceenv
Object taken from process.env
Returns (BaseProvider | undefined) newly created provider or undefined if options are not sufficient to construct a provider
Name of the provider.
To forward info/warn and error messages to
Type: Object
owner
RepositoryOwner name
string options
Object name
string /**
Abstract branch.repository
Repository provider
Provider name
string Deliver repository and branch url combined.
Returns string 'repoUrl#branch'
Returns string heades
Returns any true if not isArchived and isDisabled and isLocked and isProtected
Are we the default branch.
Returns boolean true if name matches the repository default branch
Delete the branch from the Repository.
Returns Promise<any>
Commit entries.
message
string commit messageupdates
Array<ContentEntry> content to be commitedoptions
Object Returns Promise<CommitResult>
Add commits into a pull request.
options
Object
options.pullRequestBranch
(Branch | string) to commit intooptions.dry
boolean do not create a branch and do not commit only create dummy PR (optional, default false
)options.skipWithoutCommits
boolean do not create a PR if no commits are givenoptions.bodyFromCommitMessages
boolean generate body from commit messagesoptions.body
string? body of the PRReturns Promise<PullRequest>
Remove entries form the branch.
entries
AsyncIterator<ContentEntry> Create a pull request.
Returns Promise<PullRequest>
Create a new Branch by cloning a given source branch. Simply calls Repository.createBranch() with the receiver as source branch
Returns Promise<Branch> newly created branch (or already present old one with the same name)
Type: Object
ref
string repository
repository
Repository message
string sha
string author
User committer
User Extends OwnedObject
Repository hook.
Extends OwnedObject
Extends OwnedObject
Extends BaseProvider
Provider supporting serveral repository groups.
Lookup a repository in the provider and all of its repository groups.
name
string of the repositoryReturns Promise<(Repository | undefined)>
Lookup a branch.
name
string of the branchReturns Promise<(Branch | undefined)>
Lookup a repository group.
name
string of the groupReturns Promise<(RepositoryGroup | undefined)>
List groups.
Returns AsyncIterator<RepositoryGroup> all matching repositories groups of the provider
Create a new repository group. If there is already a group for the given name it will be returend instead
Returns Promise<RepositoryGroup>
Add a new repository group (not provider specific actions are executed).
Returns RepositoryGroup
Extends BaseObject
Object with a name.
name
string Check for equality.
other
NamedObject Returns boolean true if names are equal and have the same provider
Provided name and all defined attributes.
Extends NamedObject
Named Object registering itself in the owner.
owner
name
options
additionalProperties
Removes the receiver from the owner.
Check for equality.
other
OwnedObject Returns boolean true if receiver and owner are equal
Url of home page.
Returns string as provided from the owner
Url of issue tracking system.
Returns string as provided from the repository
Forwarded from the owner.
Returns boolean
Forwarded from the owner.
Returns boolean
Forwarded from the owner.
Returns boolean
API as given by the owner.
Returns string url
API as given by the owner.
Returns string url
URL as given by the owner.
Returns string url
The provider we live in.
Returns BaseProvider
Short human readable identifier with provider and branch.
Returns string
Returns string name with owner name
Forwarded to the owner.
args
...any Forwarded to the owner.
args
...any Forwarded to the owner.
args
...any Forwarded to the owner.
args
...any Forwarded to the owner.
args
...any By default we use the owners implementation.
Returns Function as defined in the owner
By default we use the owners implementation.
By default we use the owners implementation.
By default we use the owners implementation.
By default we use the owners implementation.
By default we use the owners implementation.
Method name to be called to register one instance in the owner. sample: Application => _addApplication
Returns string
Method name to be called to unregister one instance in the owner. sample: Application => _deleteApplication
Returns string
Extends OwnedObject
Extends OwnedObject
Abstract pull request. Repository#addPullRequest
name
string source
Branch destination
Branch title
string? state
string? merged
boolean? locked
boolean? url
string Name of the PR together with the repository.
Returns string PR full name
URL of the pull request.
Returns string url
Returns Repository destination repository
Delete the pull request from the Repository.
Returns Promise
Merge the pull request.
method
string (optional, default "MERGE"
)Decline the pull request.
Returns AsyncIterator<Review>
Short human readable identifier with provider and branch.
Returns string
States to list pull request by default
Returns Set<string> states to list by default
possible states
All valid merge methods
Returns Set<string> valid merge methods.
List all pull request for a given repo. Result will be filtered by source branch, destination branch and states
repository
Repository
filter
Object?
Returns AsyncIterator<PullRequest>
Open a pull request
state of the pull request.
Returns string
Locked state of the pull request.
Returns boolean
Merged state of the pull request.
Returns boolean
Draft state of the pull request.
Returns boolean
Type: Object
name
string Extends OwnedObject
Base for Branch and Tag
Full ref path.
Returns string git ref of the Ref
Get sha of our ref.
Returns Promise<string> sha of the ref
List entries of the branch.
Returns AsyncIterator<ContentEntry> all matching entries in the branch
List all entries of the branch.
Returns AsyncIterator<ContentEntry> all entries in the branch
Get exactly one matching entry by name or undefine if no such entry is found.
name
string Returns Promise<(ContentEntry | undefined)>
Get exactly one matching entry by name (throws if entry is not found).
name
string Returns Promise<ContentEntry>
Ref owner. By default we provide the repository owner
Returns Repository
Repository and branch name combined.
Returns string 'repo#branch'
Repository fullName and branch name combined. But skipping the branch name if it is the default branch.
Returns string 'user/repo#branch'
Returns any false
Are we the default ref.
Returns boolean false
options
Can the ref be modified.
Returns boolean
Extends RepositoryOwner(OwnedObject)
Abstract repository collection.
provider
BaseProvider
name
string of the group
options
Object?
provider
BaseProvider name
string Map attributes between external and internal representation.
Type of the repository group either User or Organization.
The url of home page.
Returns string
Mixin to define a class able to handle a collection of repositories.
base
Object to be extendetType: Object
owner
RepositoryOwner
name
string (#branch) will be removed
options
Object?
name
string /**
Abstract repositoryowner
RepositoryOwner name
string without (#branch)description
string? from options.descriptionid
string? from options.idbranches
Map<string, Branch> tags
Map<string, Tag> pullRequests
Map<string, PullRequest> milestones
Map<string, Milestone> Name of the repo as used in the URL.
Returns string
Lookup entries form the head of the default branch. Branch#entry
name
Returns Promise<ContentEntry>
List entries of the default branch.
Returns AsyncIterator<ContentEntry> all matching entries in the branch
Get exactly one matching entry by name or undefined if no such entry is found.
name
string Returns Promise<(ContentEntry | undefined)>
List commits of the default branch.
options
Object? Returns AsyncIterator<Commit> all matching commits in the repository
The url used for cloning the repo.
Returns string
The url of issue tracking system.
Returns string
The url of home page.
Returns string
By default we are not archived.
Returns boolean false
By default we are not locked.
Returns boolean false
By default we are not disabled.
Returns boolean false
By default we are not a template.
Returns boolean false
Delete the repository from the Provider. Provider#deleteRepository
Returns Promise<any>
Lookup the default branch.
Returns Promise<(Branch | undefined)> branch named after defaultBranchName
Lookup branch by name.
name
string Returns Promise<(Branch | undefined)>
Returns boolean true if there is at least one branch
Returns AsyncIterator<Branch> of all branches
Create a new Branch by cloning a given source branch.
Returns Promise<Branch> newly created branch (or already present old one with the same name)
Add a new Branch. Internal branch creation does not call repository.initialize()
Returns Branch newly created branch
Delete a Branch.
name
string of the branchReturns Promise<any>
Get a Tag.
name
string Returns AsyncIterator<Tag> of all tags
Add a new Tag. Internal tag creation does not call repository.initialize()
Returns Tag newly created tag
Create a pull request (or deliver an already present for the given name).
Returns Promise<PullRequest>
Add a pull request.
Returns PullRequest
Deliver all PullRequests.
Returns AsyncIterator<PullRequest> of all pull requests
The @see PullRequest for a given name.
name
string Returns Promise<(PullRequest | undefined)>
Delete a PullRequest.
name
string Returns Promise<any>
Add a new Hook.
Returns Hook newly created hook
Add a new Hook.
hook
Hook List hooks.
Returns AsyncIterator<Hook> all hooks of the repository
Get a Hook.
Returns Promise<(Hook | undefined)> for the given id
Get a Milestone.
name
string Returns Promise<(Milestone | undefined)> for the given name
Get a Project.
name
string Returns Promise<(Project | undefined)> for the given name
Get an Application.
name
string Returns Promise<(Application | undefined)> for the given name
Get type of the repository.
Returns string 'git'
Get sha of a ref.
ref
string Returns Promise<(string | undefined)> sha of the ref
options
The name of the default branch
Returns string
Extends OwnedObject
Extends RepositoryOwner(BaseProvider)
Provider holding a single set of repositories (no repository groups).
Lookup a repository in the provider and all of its repository groups.
name
string of the repositoryReturns Promise<(Repository | undefined)>
Get a single group.
name
string Returns Promise<(RepositoryGroup | undefined)> deliver the one and only present group
List groups.
Returns AsyncIterator<RepositoryGroup> always deliver the one and only present group
Extends Ref
Tag refs
Returns string tags
Convert scalar into an array. The value undefined will be represented as an empty array.
value
(Array | any) Returns Array value encapsulated in an array
Strip repository base name away. A URL auth component will be removed to.
name
(string | undefined) repositoryBases
Array<string> all possible baseswhenFound
Function? to be called with the found base nameReturns (string | undefined) name without base
Loops over names and executes stripBaseName.
names
(Array<string> | string | undefined) repositoryBases
Array<string> all possible baseswhenFound
Function? to be called with the found base nameReturns (Array<string> | string | undefined) names without base
Find a new branch name for a given pattern. '' will be replaced by a number. 'something/' will get to something/1 something/2 ...
repository
Repository pattern
string With npm do:
npm install repository-provider
BSD-2-Clause
FAQs
abstract interface to git repository providers like github, bitbucket and gitlab
The npm package repository-provider receives a total of 735 weekly downloads. As such, repository-provider popularity was classified as not popular.
We found that repository-provider demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.